<!doctype html>
<!--[if lt IE 7]>
<html class="no-js ie6 oldie" lang="en"> <![endif]-->
<!--[if IE 7]>
<html class="no-js ie7 oldie" lang="en"> <![endif]-->
<!--[if IE 8]>
<html class="no-js ie8 oldie" lang="en"> <![endif]-->
<!--[if gt IE 8]><!-->
<html class="no-js" lang="en" xmlns:th="http://www.w3.org/1999/xhtml"> <!--<![endif]-->
<head>
    <meta charset="utf-8">
    <title>交接班详情</title>
    <link rel="stylesheet" href="/css/workInfoStyle.css">
</head>


<body>

<div id="container">

    <!-- header block -->

    <header class="wrap-header">
        <article>

            <div class="wrap-ribbons">
                <!--<a class="ribbon" href="#">Download <em>CV</em></a>-->
                <form>

                </form>

                <form id="workinfoForm">
                    <input type="hidden" name="id"/>
                    <a class="ribbon ribbon2 zoom-html" href="#" id="readit">标记为 <em>已读</em></a>
                </form>
                <a class="ribbon" href="#" id="worklog-type">状态 <em></em></a>
            </div>

            <div class="wrap-title">
                <h1>标题： <span></span></h1>
                <p>有效期至：<span></span></p>
            </div>
            <div class="social-services">
                <a href="#" class="twitter-share-button" data-align="left">发布人：<span>张三</span></a>
            </div>

        </article>
    </header>
    <div class="row row-info">
        <article class="markup">

            <h2 class="section-title">内容</h2><br/>


            <div id="content">

            </div>

        </article>
    </div>
    <div class="row row-info">
        <article class="markup">

            <h2 class="section-title">阅读过的人</h2><br/>
            <p id="read-man">

            </p>

        </article>
    </div>
</div>
<div th:include="js :: js"></div>
<script type="text/javascript" th:attr="src=@{/js/jquery.form.js}"></script>
<script type="text/javascript" th:attr="src=@{/js/jquery.parser.js}"></script>
<script type="text/javascript" src="js/jquery.icheck/icheck.min.js"></script>
<script type="text/javascript">
    //window.onbeforeunload=function(){return "请确认是否已经标为已读，谢谢";}
    $(function () {
        var urlParam = window.location.search;
        var workid = urlParam.split('=')[1];
        $.post("/AdminInterface/queryAdminByid?id=" + workid, function (data) {
            console.log(data);
            $("input[name='id']").val(data.id);
            $(".social-services a span").text(data.adminName);
            $(".wrap-title h1 span").html(data.title);
            $("#titleh1").html(data.title);

            $("#content").html(data.content);
            var typeVal = data.type;
            var typeText = "";
            switch (typeVal) {
                case 1:
                    typeText = "正常";
                    break;
                case 2:
                    typeText = "一般";
                    break;
                case 3:
                    typeText = "重点注意";
                    $("#worklog-type").addClass("ribbon3");
                    break;
                case 4:
                    typeText = "全体注意事项";
                    $("#worklog-type").addClass("ribbon3");
                    break;
                case 5:
                    typeText = "新增渠道";
                    $("#worklog-type").addClass("ribbon3");
                    break;
            }
            $("#worklog-type em").text(typeText);
            //
            if (data.readAdmin != null) {
                $("#read-man").text(data.readAdmin);
            } else {
                $("#read-man").text("");
            }
            $(".wrap-title p span").text(data.validity.split('.')[0]);
        });
//
        $("#readit").click(function () {
            if (confirm("确定要这么做吗？")) {
                $.post("/AdminInterface/readerInsert", $("#workinfoForm").serialize(), function (data) {
                    $.post("/AdminInterface/queryAdminByid?id=" + workid, function (data) {
                        $("#read-man").text(data.readAdmin);
                        window.opener.location.reload();
                    });
                }).error(function (e) {
                });
            }
        });
    });
</script>
</body>
</html>
